﻿using System;
using System.Windows.Media;
using System.Windows.Shapes;

namespace Utils.Wpf.Chart
{
	public class VerticalLine
	{
		#region Attributes

		private Brush _colour;
		private VerticalLineType _type;
		private double _opacity;

		#endregion

		#region Properties

		public DateTime Date { get; set; }

		public Brush Colour
		{
			get
			{
				return _colour;
			}
			set
			{
				if (_colour != value)
				{
					_colour = value;
					this.Line.Stroke = _colour;
				}
			}
		}

		public VerticalLineType Type
		{
			get
			{
				return _type;
			}
			set
			{
				if (_type != value)
				{
					_type = value;
					switch (_type)
					{
						case VerticalLineType.DotLine:
							this.Line.StrokeDashArray = new DoubleCollection(new double[] { 4, 8, 16, 8 });
							break;
						case VerticalLineType.Dotted:
							this.Line.StrokeDashArray = new DoubleCollection(new double[] { 4, 8 });
							break;
						case VerticalLineType.Solid:
							this.Line.StrokeDashArray = null;
							break;
					}

				}
			}
		}

		public double Opacity
		{
			get
			{
				return _opacity;
			}
			set
			{
				_opacity = value;
				this.Line.Opacity = _opacity;
			}
		}

		public Line Line { get; private set; }

		#endregion

		#region Public Methods

		public VerticalLine()
		{
			this.Line = new Line();
		}

		#endregion
	}
}
